package com.holiday.springboot2.listener;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 * 会话在监听器，这个会话监听是长期存在的
 *  1、实现HttpSessionListener ，并重写方法
 *      1、sessionCreated
 *      2、sessionDestroyed
 */
@WebListener
public class SessionListener implements HttpSessionListener {
    @Override
    public void sessionCreated(HttpSessionEvent se) {
        HttpSessionListener.super.sessionCreated(se);
        System.out.println("sessionCreated-------");
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        HttpSessionListener.super.sessionDestroyed(se);
        System.out.println("sessionDestroyed-------");
    }
}
